package langnstats.project.languagemodel.ngram;

import java.util.HashMap;

import langnstats.project.tools.CountMap;


public class NgramCounter<T> extends HashMap<History<T>, CountMap<T>> {

	private static final long serialVersionUID = 1L;
	
	public CountMap<T> get(Object key){
		if(!(key instanceof History)){ return null; }
		
		CountMap<T> cm = super.get(key);
		if(cm==null){
			cm = new CountMap<T>();
			this.put((History<T>)key, cm);
		}
		return cm;
	}

}
